
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QListWidgetItem>
#include <QMainWindow>
#include <QTemporaryFile>
#include <QWidget>

QT_BEGIN_NAMESPACE

QT_END_NAMESPACE
namespace Ui {
    class MainWindow;
}
class RouteItemWidget;
class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    int find_metric(const QString &var);
    QString modify_metric(const QString &var, int metric);

private slots:
    void on_btn_refresh_clicked();
    void on_list_ip_route_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
    void on_btn_ok_clicked();
    void on_action_add_route_triggered();


private slots:
    void slot_route_deleted(RouteItemWidget *route_widget);
    void slot_route_restore_deleted(RouteItemWidget *route_widget);
    void slot_route_apply_signal(RouteItemWidget *route_widget);

private:
    Ui::MainWindow *ui;

    // QWidget interface
protected:
    QString make_tempfile(QString var);
    void make_scripts(QString var);
    void copy_script();
    void keyPressEvent(QKeyEvent *event) override;
};

#endif // MAINWINDOW_H

